{% extends "help/base.html" %}
{% load i18n %}

{% block help_con %}
<h3 class="hd">{% trans "Seafile client for a CLI server" %}</h3>

<h4 id="installation">{% trans "Installation" %}</h4>
<p>{% blocktrans %}You can follow <a href="{{ SITE_ROOT }}help/install_linux_client/">this documentaion</a> to install Seafile CLI client on various Linux distributions.{% endblocktrans %}</p>

<h4 id="basic-usage">{% trans "Basic usage" %}</h4>
<p>{% trans "Initialize & start the client" %}</p>
<pre><code class="lang-sh"><span class="hljs-comment"># choose a folder where to store the seafile client settings e.g ~/seafile-client</span>
mkdir ~/seafile-client            <span class="hljs-comment"># create the settings folder</span>
seaf-cli init <span class="hljs-_">-d</span> ~/seafile-client  <span class="hljs-comment"># initialise seafile client with this folder</span>
seaf-cli start
</code></pre>
<p>{% trans "Download and sync a library from a server" %}</p>
<ul>
  <li>{% trans "retrieve the library id by browsing into a library on the server. The ID is part of the URL. The format looks like <code>f4962ce9-ba07-47b8-a83a-73dd96c2ebfd</code>." %}</li>
  <li>{% trans "then" %}
    <pre><code class="lang-sh">seaf-cli download <span class="hljs-_">-l</span> <span class="hljs-string">"the id of the library"</span> <span class="hljs-_">-s</span>  <span class="hljs-string">"the url + port of server"</span> <span class="hljs-_">-d</span> <span class="hljs-string">"the folder where the library folder will be downloaded"</span> -u <span class="hljs-string">"username on server"</span> [-p <span class="hljs-string">"password"</span>]
seaf-cli status  <span class="hljs-comment"># check status of ongoing downloads</span>
<span class="hljs-comment"># Name  Status  Progress</span>
<span class="hljs-comment"># Apps    downloading     9984/10367, 9216.1KB/s</span>
    </code></pre>
  </li>
</ul>
<p>{% trans "Note: if you don't supply the password parameter in the command, it will be asked later, which is more secure." %}</p>
<p>{% trans "Example: <code>seaf-cli download -l 0536c006-8a43-449e-8718-39f12111620d -s http://cloud.seafile.com -d /tmp -u freeplant@test.com</code>" %}</p>
<p>{% trans "The above command will create a <strong>new folder</strong> with the same name as the library under the specified folder." %}</p>
<p>{% trans "You can also sync a library with an <strong>existing folder</strong> on the local computer. The existing files in the local folder will be merged with the files in the library." %}</p>
<pre>
<code>seaf-cli sync -l "the id of the library" -s  "the url + port of server" -d "the folder which the library will be synced with" -u "username on server" [-p "password"]</code>
</pre>
<p>{% trans "After running the <code>download</code> or <code>sync</code> command, the local folder will be automatically synced with the library." %}</p>

<h4>{% trans "Detailed documentation" %}</h4>
<p>{% trans "seaf-cli is the command line interface for seafile client." %}</p>
<p>{% trans "Subcommands:" %}</p>
<pre><code>    init                Initialize config directory
    start               Start ccnet and seafile daemon
    stop                Stop ccnet and seafile daemon
    list                List local libraries
    list-remote         List remote libraries
    status              Show syncing status
    download            Download and sync a library from seafile server 
    download-by-name    Download and sync a library defined by name from seafile server 
    sync                Sync a library with an existing folder
    desync              De-sync a library with seafile server
    create              Create a library
    config              Configure seafile client
</code></pre>
<p>{% trans "Running <code>seaf-cli -h</code> will show the above help. For each subcommand, you can also use <code>-h</code> option to get help, e.g. <code>seaf-cli download -h</code>." %}</p>

<h5>{% trans "Detail" %}</h5>
<p>{% trans "Seafile client stores all its configure information in a config dir. The default location is <code>~/.ccnet</code>. All the commands below accept an option <code>-c &lt;config-dir&gt;</code>." %}</p>

<h6 id="init">init</h6>
<p>{% trans "Initialize seafile client. This command initializes the config dir. It also creates sub-directories <code>seafile-data</code> and <code>seafile</code> under <code>parent-dir</code>. <code>seafile-data</code> is used to store internal data, while <code>seafile</code> is used as the default location put downloaded libraries." %}</p>
<pre><code>seaf-cli init [-c &lt;config-dir&gt;] -d &lt;parent-dir&gt;
</code></pre>
<p>{% trans "A file named <code>seafile.ini</code> will be created under <code>~/.ccnet</code> to record the location of <code>seafile-data</code> directory." %}</p>
<p>{% trans "If you want to run multiple instances of Seafile cli client in the same machine, you can specify different <code>config-dir</code> and <code>parent-dir</code> when initializing different client instances. Then the instances can run without interfering each others. When starting the instances, just specify ccnet config directories with the <code>-c</code> option." %}</p>

<h6 id="start">start</h6>
<p>{% trans "Start seafile client. This command starts <code>seaf-daemon</code>, which is the file syncing engine for Seafile client." %}</p>
<pre><code>seaf-cli start [-c &lt;config-dir&gt;]
</code></pre>

<h6 id="stop">stop</h6>
<p>{% trans "Stop seafile client." %}</p>
<pre><code>seaf-cli stop [-c &lt;config-dir&gt;]
</code></pre>

<h6 id="download">download/download-by-name</h6>
<p>{% trans "Download and sync a library from seafile server. It will create a <b>new folder</b> with the same name as the library under the parent folder. The local folder will be automatically synced with the library. The download-by-name command works similarly, but can save you from finding the library ID. It only works when the library name is unique on the server." %}</p>
<pre><code>seaf-cli download -l &lt;library-id&gt; -s &lt;seahub-server-url&gt; -d &lt;parent-directory&gt; -u &lt;username&gt; [-p &lt;password&gt;]
</code></pre>

<h6 id="sync">sync</h6>
<p>{% trans "Synchronize a library with an existing folder. The existing files in the local folder will be merged with the files in the library." %}</p>
<pre><code>seaf-cli sync -l &lt;library-id&gt; -s &lt;seahub-server-url&gt; -d &lt;existing-folder&gt; -u &lt;username&gt; [-p &lt;password&gt;]
</code></pre>

<h6 id="desync">desync</h6>
<p>{% trans "Desynchronize a library from seafile server. After running this command, the local folder will no longer be synced with the server." %}</p>
<pre><code>seaf-cli desync -d &lt;existing-folder&gt;</code></pre>

<h6 id="create">create</h6>
<p>{% trans "Create a new library on server." %}</p>
<pre><code>seaf-cli create [-h] -n library-name -t description [-e library-password] -s server -u username -p password</code></pre>

<h6 id="list">list</h6>
<p>{% trans "List information about synced libraries. The information includes library name, library ID and local folder path for the library." %}</p>
<pre><code>seaf-cli list</code></pre>

<h6 id="list-remote">list-remote</h6>
<p>{% trans "List information about synced libraries. The information includes library name, library ID and local folder path for the library." %}</p>
<pre><code>seaf-cli list-remote</code></pre>

<h6 id="status">status</h6>
<p>{% trans "List information about synced libraries. The information includes library name, library ID and local folder path for the library." %}</p>
<pre><code>seaf-cli status</code></pre>
<p>{% trans "The returned status and their meaning:" %}</p>
<table>
  <thead>
    <tr>
      <th>status</th>
      <th>{% trans "meaning" %}</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>synchronized</td>
      <td>{% trans "Local folder is consistent with the remote library" %}</td>
    </tr>
    <tr>
      <td>committing</td>
      <td>{% trans "Files in local folder are being indexed" %}</td>
    </tr>
    <tr>
      <td>initializing</td>
      <td>{% trans "Getting sync information from server" %}</td>
    </tr>
    <tr>
      <td>downloading file list</td>
      <td>{% trans "Downloading file list from server. Progress will be displayed." %}</td>
    </tr>
    <tr>
      <td>downloading files</td>
      <td>{% trans "Downloading files from server. Progress will be displayed." %}</td>
    </tr>
    <tr>
      <td>uploading</td>
      <td>{% trans "Uploading files to server. Progress will be displayed." %}</td>
    </tr>
    <tr>
      <td>error</td>
      <td>{% trans "Error message will be displayed in the progress column." %}</td>
    </tr>
  </tbody>
</table>

<h6 id="skip-ssl-certificate-verify">{% trans "Skip SSL certificate verification" %}</h6>
<p>{% trans "If you're using self-signed certificate on the server, you should ask the client to skip verifying certificate." %}</p>
<pre><code>seaf-cli config -k disable_verify_certificate -v true
</code></pre>

<h6 id="set-transfer-speed-limit">{% trans "Set transfer speed limit" %}</h6>
<p>{% trans "Set upload speed limit to 1MB/s :" %}</p>
<pre><code class="lang-sh">seaf-cli config -k upload_<span class="hljs-built_in">limit</span> -v 1000000
</code></pre>
<p>{% trans "Set download speed limit to 1MB/s :" %}</p>
<pre><code class="lang-sh">seaf-cli config -k download_<span class="hljs-built_in">limit</span> -v 1000000
</code></pre>

<h6 id="two-factor-authentication">{% trans "Two factor authentication" %}</h6>
<p>{% trans "seaf-cli supports 'Two Factor Authentication'." %}</p>
<p>{% trans "If you want to use the feature, you should add the argument <code>--tfa <token></code> to any <code>seaf-cli</code> commands. <code><token></code> is Google Authenticator's verification code." %}</p>
<p>{% trans "For example:" %}</p>
<pre><code class="lang-sh">seaf-cli download <span class="hljs-_">-l</span> <span class="hljs-string">"4b11d9d4-e3b1-4394-be85-9d4a80f626fa"</span> <span class="hljs-_">-s</span> <span class="hljs-string">"https://demo.seafile.top"</span> <span class="hljs-_">-d</span> <span class="hljs-string">"testst"</span> -u <span class="hljs-string">"abc@abc.com"</span> -p <span class="hljs-string">"abc"</span> --tfa 002755
</code></pre>
{% endblock %}
